<?php
//The next comment block is for PHPDocumentor
/**
 * Conference Registration - Registration for conferences
 * 
 * Admin menu option:
 * Setup a new conference
 * 
 * @author Kevin van Haaren (kevin@vanhaaren.net)
 * @copyright 2006 Kevin van Haaren, US
 * @package CONFREG
 * @subpackage Admin_Function
 * 
 */

/**
* Do all the declarations etc needed by an admin page
*/
include_once "adminheader.inc";

//Display the admin menu
xoops_module_admin_menu(1,_AM_CONFREG_ADMENU0);

$conferences =& $xoopsDB->query("SELECT *" .
								" FROM " . $xoopsDB->prefix("confreg_conferences"));

$conf_count = $xoopsDB->getRowsNum($conferences);
echo "<table width=90%>";
echo '<tr><th style="text-align:center;">Conf<br />ID</th><th width=33% style="text-align:center;">Title</th><th style="text-align:center;">Start Date</th><th style="text-align:center;">End Date</th><th style="text-align:center;">Reg Open</th><th style="text-align:center;">Reg Close</th><th>&nbsp;</th></tr>';
if ($conf_count > 0) {
	while ($confData = $xoopsDB->fetchArray($conferences)) {
		echo "<tr>";
		echo '<td style="text-align:center;">' . $confData['conf_id'] . "</td>";
		echo "<td>" . $confData['title'] . "</td>";
		echo '<td style="text-align:right;">' . substr($confData['start_date'],0,10) . "</td>";
		echo '<td style="text-align:right;">' . substr($confData['end_date'],0,10) . "</td>";
		echo '<td style="text-align:right;">' . substr($confData['reg_start'],0,10) . "</td>";
		echo '<td style="text-align:right;">' . substr($confData['reg_end'],0,10) . "</td>";
		 echo '<td style="text-align:center;"><form action="addextras.php" method=post><input type=hidden name=conf_id value=' . $confData['conf_id'] . '><input type=submit value="' . _AM_CONFREG_EXTRA_ADD . '"></form><br /><form action="get_coupon_data.php" method=post><input type=hidden name=conf_id value=' . $confData['conf_id'] . '><input type=submit value="' . _AM_CONFREG_COUPON_ADD . '"></form></td>';
		echo "</tr>";
	}
} else {
	echo "<tr><td colspan=6>No conferences defined yet.</td></tr>";
}
echo "</table></div><br /><br />";

include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';

// conference description
$cform = new XoopsThemeForm(_AM_CONFREG_CONF_CREATE,'createconf','createconf.php', 'POST');
$cform->addElement(new XoopsFormText(_AM_CONFREG_CONF_TITLE, 'title', 60, 128));
$cform->addElement(new XoopsFormText(_AM_CONFREG_CONF_LOCATION, 'location', 60, 128));
$cform->addElement(new XoopsFormText(_AM_CONFREG_CONF_HELPCONTACT, 'helplink', 30, 128));
$cform->addElement(new XoopsFormText(_AM_CONFREG_CONF_OFFSET . '<br /><br /><span style="font-weight:normal;">' . _AM_CONFREG_CONF_OFFSETDESC . "</span>", 'invoffset', 10, 10));
$cform->addElement(new XoopsFormText(_AM_CONFREG_CONF_SCHEDLINK, 'schedlink', 60, 128));

// date times
$cform->addElement(new XoopsFormDateTime(_AM_CONFREG_CONF_STARTDATE, 'confstart', 15, 0));
$cform->addElement(new XoopsFormDateTime(_AM_CONFREG_CONF_ENDDATE, 'confend', 15, 0));
$cform->addElement(new XoopsFormDateTime(_AM_CONFREG_CONF_REGSTART, 'regstart', 15, 0));
$cform->addElement(new XoopsFormDateTime(_AM_CONFREG_CONF_REGEND, 'regend', 15, 0));

// costs and discount fields
$cform->addElement(new XoopsFormText(_AM_CONFREG_CONF_EARLYCOST, 'early_cost', 10, 10));
$cform->addElement(new XoopsFormDateTime(_AM_CONFREG_CONF_EARLYCUTOFF, 'early_cutoff', 15, 0));
$cform->addElement(new XoopsFormText(_AM_CONFREG_CONF_LATECOST, 'late_cost', 10, 10));

$cform->addElement(new XoopsFormButton(_AM_CONFREG_CREATE, 'submit', _AM_CONFREG_SUBMIT, 'submit'));

$cform->display();

/**
* and here.
*/
//And put footer in
xoops_cp_footer();

/*
 * This file was generated by XBS ModGen, (c) 2006 A Kitson, UK. See http://xoobs.net
 * ModGen is a Module Code Generator for the Xoops CMS.  See http://xoops.org
 */
?>
